package com.zbkj.crmeb.task.product;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import com.xxl.job.core.handler.annotation.XxlJob;
import com.zbkj.crmeb.upload.service.UploadService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Configuration
public class ProductImageTask {

    @Autowired
    private UploadService uploadService;

    private Boolean runable = true;

    /**
     * 上传图片到oss定时任务30min
     */
	@XxlJob("productImageTask")
    public void runTask(){
        log.info(" -------- 执行上传图片定时任务 ! runable: {}",runable);
        if(!runable){
            return;
        }
        runable = false;
        uploadService.timingUpload("/data/imageFile");
        runable = true;
    }

}
